package com.invengo.module_check.ui.fragment.widget.item;

import androidx.annotation.NonNull;

import com.invengo.library_rfid.entity.TagInfo;
import com.invengo.module_check.ui.fragment.widget.AnalyzeTestViewModel;

import me.goldze.mvvmhabit.base.ItemViewModel;
import me.goldze.mvvmhabit.bus.event.SingleLiveEvent;

public class AnalyzeItemViewModel extends ItemViewModel<AnalyzeTestViewModel> {
    public SingleLiveEvent<String> oneValue = new SingleLiveEvent<>();
    public SingleLiveEvent<String> twoValue = new SingleLiveEvent<>();

    public AnalyzeItemViewModel(@NonNull AnalyzeTestViewModel viewModel, TagInfo tagInfo) {
        super(viewModel);
        switch (tagInfo.getRfidModel()) {
            case EPC:
                oneValue.postValue(tagInfo.getEpc());
                twoValue.postValue(tagInfo.getTag());
                break;
            case TID:
                oneValue.postValue(tagInfo.getEpc());
                twoValue.postValue("当前tid模式");
                break;
        }
    }
    public int getPosition() {
        return viewModel.getPosition(this) + 1;
    }
}
